These are the replication files for the article 

"Stand by those who share our values" – how refugees fleeing the
Taliban improved European attitudes toward immigration,

by Joris Frese,
accepted for publication in Comparative Political Studies.

To one-click reproduce all analyses conducted for this article, simple run 
the "Main Script.R" script, which is a master script
that sources and interacts with all other scripts and data files in this folder.

Beware however that some of the individual scripts take very long to run,
especially the script for the bandwidth tests, and the scripts for the
computational text analyses. Therefore, I have included some shortcuts in those
scripts. For the bandwidth tests, there is a second script with fewer, manually
estimated bandwidth tests which can be run much faster ("Manual Bandwidths.R").
For the computational text analyses, there are options within each script, after
each of the slowest operations (the topic models and the VADER sentiment analyzer),
to load the dataframes containing the results directly into the environment without
having to run the full models each time. If you do want to rerun the full models yourself,
just uncomment the code that says "UNCOMMENT THIS IF YOU WANT TO RERUN X".

Beware also that, should you choose to run individual scripts 1-by-1,
you are advised to run them in the order in which they are listed in the master script 
to ensure that all dependencies work properly.

As long as you leave the "CPS Frese Project" R project in the same folder
as the scripts and data, all file-path dependencies will also work without 
the need to specify your local file-paths.

Last but not least, I apologize for the many clumsy and overly long code blocks 
in the individual scripts. Don´t judge me too harshly; most of this code was 
written in the early days of my PhD :D.